<template>
	<view>
		<view class="goods_list">
			<view class="goods_item" v-for="item in goods" :key="item.id" @click="goodsDetail(item.id)">
				<image :src="item.img_url" mode=""></image>
				<view class="price">
					<text>￥{{item.price}}</text>
				</view>
				<view class="name">
					{{item.name}}
				</view>
			</view>
			<view class="goods_item" @click="goodsDetail(id)">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥9.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view> 
			<view class="goods_item">
				<image src="../static/imgs/dog.jpg" mode=""></image>
				<view class="price">
					<text>￥109</text>
				</view>
				<view class="name">
					鹤顶红
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
			<view class="goods_item">
				<image src="../static/imgs/1.jpg" mode=""></image>
				<view class="price">
					<text>￥19.9</text>
				</view>
				<view class="name">
					伸腿瞪眼丸
				</view>
			</view>
		<view class="is_over">————&nbsp;&nbsp;我是有底线的&nbsp;&nbsp;————</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:["goods"],
		data() {
			return {

			};
		},
		methods:{
			goodsDetail(id){
				console.log(id)
				//触发父组件事件
				this.$emit("goodsItemClick")
			},
			
		}
	}
</script>

<style lang="scss">
	.goods_list {
		padding: 0 8rpx;
		display: flex; //一行
		flex-wrap: wrap; //换行
		justify-content: space-between; //间距

		.goods_item {
			background: #fff;
			width: 365rpx;
			margin-top: 8rpx;
			margin-bottom: 3rpx;
			padding: 15rpx;
			box-sizing: border-box;

			image {
				width: 100%;
				height: 150px;
				// display: block;
				// margin: auto;
			}

			.price {
				color: #FF6A6A;
				font-size: 15px;
			}

			.name {
				font-size: 16px;
				padding-bottom: 7rpx;
				padding-top: 8rpx;
			}
		}
		.is_over {
			width: 100%;
			// height: 50px;
			line-height: 40px;
			color: #808888;
			text-align: center;
			font-size: 26rpx;
		}
	}
</style>
